//import 'dotenv/config'

import * as step from '@flow-step/step-toolkit'
import * as process from 'process'
import {execute} from './execute-step'
import {masking} from './util'

async function runStep(): Promise<void> {
    //检查当前环境是否安装了Git
    // 如果是windows 就判断是否安装git，否则不判断
    let envs = process.env.PATH
    if(process.platform == 'win32' && envs != undefined && !envs.includes('Git')){
        step.error('Please install Git or set global envs first!')
        throw new Error('check git failed!')
    }

    // install git
    //await installGit()

    // 执行克隆操作
    await execute()
}

runStep()
    .then(function () {
        step.info('Clone all sources successfully!')
    })
    .catch(function (err: Error) {
        step.error(masking(err.message))
        process.exit(-1)
    })

